package com.mdd.admin.validate.crontab;

import com.mdd.admin.validate.staff.StaffParam;
import com.mdd.common.validator.annotation.IDMust;
import com.mdd.common.validator.annotation.IntegerContains;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;

import lombok.Data;
import javax.validation.constraints.*;
import java.io.Serializable;

/**
 * 计划任务参数
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class DevCrontabParam implements Serializable {

    private static final long serialVersionUID = 1L;

    public interface create{}
    public interface update{}
    public interface delete{}

    @NotNull(message = "id参数必传且需大于0", groups = {StaffParam.update.class, StaffParam.delete.class})
    private Long id;

    @NotNull(message = "name参数缺失", groups = {create.class, update.class})
    @Length(max = 32, message = "name参数不能超出32个字符", groups = {create.class, update.class})
    private String name;

    @NotNull(message = "type参数缺失", groups = {create.class, update.class})
    @DecimalMin(value = "0", message = "type参数值不能少于0", groups = {create.class, update.class})
    private Integer type;

    @NotNull(message = "system参数缺失", groups = {create.class, update.class})
    @DecimalMin(value = "0", message = "system参数值不能少于0", groups = {create.class, update.class})
    private Integer system;

    @Length(max = 255, message = "remark参数不能超出255个字符", groups = {create.class, update.class})
    private String remark;

    @NotNull(message = "command参数缺失", groups = {create.class, update.class})
    @Length(max = 64, message = "command参数不能超出64个字符", groups = {create.class, update.class})
    private String command;

    @NotNull(message = "params参数缺失", groups = {create.class, update.class})
    @Length(max = 64, message = "params参数不能超出64个字符", groups = {create.class, update.class})
    private String params;

    @NotNull(message = "status参数缺失", groups = {create.class, update.class})
    @DecimalMin(value = "0", message = "status参数值不能少于0", groups = {create.class, update.class})
    private Integer status;

    @NotNull(message = "expression参数缺失", groups = {create.class, update.class})
    @Length(max = 64, message = "expression参数不能超出64个字符", groups = {create.class, update.class})
    private String expression;
    @Length(max = 256, message = "error参数不能超出256个字符", groups = {create.class, update.class})
    private String error;

    @DecimalMin(value = "0", message = "lastTime参数值不能少于0", groups = {create.class, update.class})
    private Long lastTime;

    @Length(max = 64, message = "time参数不能超出64个字符", groups = {create.class, update.class})
    private String time;

    @Length(max = 64, message = "maxTime参数不能超出64个字符", groups = {create.class, update.class})
    private String maxTime;

}
